<?php

namespace app\common\util;

class YcLog
{
    protected static $channel = "default";

    public static function init($channel = "default")
    {
        self::$channel = $channel;
    }

    /**
     * 信息日志
     * @param $message
     * @param array $context
     * @return void
     */
    public static function info($message, array $context = []): void
    {
        \support\Log::channel(self::$channel)->info($message, $context);
    }

    /**
     * 调试日志
     * @param $message
     * @param array $context
     * @return void
     */
    public static function debug($message, array $context = []): void
    {
        \support\Log::channel(self::$channel)->debug($message, $context);
    }

    /**
     * 错误日志
     * @param $message
     * @param array $context
     * @return void
     */
    public static function error($message, array $context = []): void
    {
        \support\Log::channel(self::$channel)->error($message, $context);
    }

    /**
     * 打印日志
     * @param $level
     * @param $message
     * @param array $context
     * @return void
     */
    public static function log($level, $message, array $context = []): void
    {
        \support\Log::channel(self::$channel)->log($level, $message, $context);
    }

    /**
     * 通知日志
     * @param $message
     * @param array $context
     * @return void
     */
    public static function notice($message, array $context = []): void
    {
        \support\Log::channel(self::$channel)->notice($message, $context);
    }

    /**
     * 警告日志
     * @param $message
     * @param array $context
     * @return void
     */
    public static function warning($message, array $context = []): void
    {
        \support\Log::channel(self::$channel)->warning($message, $context);
    }
}
